# 设置交叉编译的目标操作为windows
SET(CMAKE_SYSTEM_NAME Windows)
add_compile_options(-m64 -O3)
# 指定c/c++编译器
SET(CMAKE_C_COMPILER  x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)


set( CMAKE_C_FLAGS             "-std=gnu99"                         CACHE STRING "c flags" )
set( CMAKE_CXX_FLAGS           "-std=c++11"                         CACHE STRING "c++ flags" )
set( CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++"   CACHE STRING "shared linker flags" )
set( CMAKE_MODULE_LINKER_FLAGS "-static-libgcc -static-libstdc++"   CACHE STRING "module linker flags" )
# 指定编译目标操作系统版本时的搜索根路径
SET(CMAKE_FIND_ROOT_PATH  /sdks/mingw-w64 )

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search 
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)